package com.zqh.app.manager.impl;

import com.zqh.app.dao.GroupInfoMapper;
import com.zqh.app.entity.GroupInfo;
import com.zqh.app.manager.AppGroupInfoManager;
import com.zqh.common.entity.Page;
import com.zqh.common.entity.Query;
import com.zqh.common.entity.R;
import com.zqh.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("AppGroupInfoManager")
public class AppGroupInfoManagerImpl implements AppGroupInfoManager {

    @Autowired
    GroupInfoMapper groupInfoMapper;

    @Override
    public R addMembers(List<GroupInfo> groupInfos) {
        int count = groupInfoMapper.batchSave(groupInfos);
        return CommonUtils.msg(count);
    }

    @Override
    public R delMember(int groupInfoId) {
        int count = groupInfoMapper.remove(groupInfoId);
        return CommonUtils.msg(count);
    }

    @Override
    public List<GroupInfo> getGroupUsers(Page<GroupInfo> page, Query form) {
        return groupInfoMapper.listForPage(page, form);
    }
}
